package com.da.boot.bean;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author JokerDa.
 * @date 2021/1/19 15:24
 * Description: 必须加入容器才能使@ConfigurationProperties(prefix = "mycar")生效
 * 或者在配置类上面写@EnableConfigurationProperties(Car.class)但是就不能这么获取bean了context.getBean("car", Car.class)
 */
@Data
@Component
@ConfigurationProperties(prefix = "mycar")
public class Car {
    private String brand;
    private int price;
}
